// gcc `edje-config --cflags --libs` `ecore-config --cflags --libs` example.c -o e
// gcc `pkg-config --cflags --libs ecore ecore-evas edje` sample.c -o sample
#include <Ecore_Evas.h>
#include <Ecore.h>
#include <Edje.h>
#include <stdlib.h>
#include <stdio.h>

/* GLOBALS */
Ecore_Evas  *ee;
Evas        *evas;
Evas_Object *edje;
//double edje_w, edje_h;
Evas_Coord edje_w, edje_h;

int
app_signal_exit(void *data, int type, void *event)
{
	printf("DEBUG: Exit called, shutting down\n");
	ecore_main_loop_quit();

	return 1;
}

int
main(int argv, char *argc[])
{
	ecore_init();
	ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT, app_signal_exit, NULL);

	ecore_evas_init();
	ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 800, 480);
	ecore_evas_title_set(ee, "TITLE");
	ecore_evas_borderless_set(ee, 0);
	ecore_evas_shaped_set(ee, 0);
	ecore_evas_show(ee);

	evas = ecore_evas_get(ee);
	evas_font_path_append(evas, "/usr/share/edje/data/test/fonts/");

	edje_init();
	edje = edje_object_add(evas);
	//edje_object_file_set(edje, "crossfade.eet", "test");
	edje_object_file_set(edje, "sample.edj", "test");
	evas_object_move(edje, 20, 20);
	edje_object_size_min_get(edje, &edje_w, &edje_h);
	evas_object_resize(edje, edje_w, edje_h);
	evas_object_show(edje);
	ecore_evas_resize(ee, (int)edje_w, (int)edje_h);
	ecore_evas_show(ee);
	ecore_main_loop_begin();

	return 0;
}

